package com.example.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fangjx
 * @date 2021/2/9
 */
@RestController
@RequestMapping("other")
public class TestController {

    //读取yml是默认打开的  读取properties得去开启@PropertySource

    @Value("${a}")          // properties
    private String a;

    @Value("${liuliu.test}")        // application.yml
    private String liuliu;

    @GetMapping("other")
    public void other(){
        System.out.println(a);
        System.out.println(liuliu);
    }
 
}
